<?php
/**
 * Created by PhpStorm.
 * User: iamya
 * Date: 2017/10/18
 * Time: 9:47
 */

namespace app\circle\model;


class MemberReportModel extends BaseModel
{
    protected $name = 'circle_member_report'; //定义用户表
    //开启自动写入时间戳
    protected $autoWriteTimestamp = true;
    // 定义自动完成的属性
    protected $auto = []; //新增修改
    protected $insert = []; //插入
    protected $update = []; //修改
    protected $append=['member_info','report_member_info','theme_info','create_time','update_time'];

    protected function getCreateTimeAttr($value,$data)
    {
        return date('Y-m-d H:i',$value);
    }
    protected function getUpdateTimeAttr($value,$data)
    {
        return date('Y-m-d H:i',$value);
    }
    protected function getMemberInfoAttr($value, $data)
    {
        $model=new MemberModel();
        return $model->where('member_id',$data['member_id'])->find();
    }

    protected function getReportMemberInfoAttr($value, $data)
    {
        $model=new MemberModel();
        return $model->where('member_id',$data['report_member_id'])->find();
    }
    protected function getThemeInfoAttr($value,$data){
        $model=new ThemeModel();
        return $model->where('theme_id',$data['theme_id'])->find();
    }
}